using System;
using System.Collections.Generic;
using System.Text;
using log4net;

namespace Watchdog.WcF {

    internal static class Log {

        static ILog log = log4net.LogManager.GetLogger ( typeof ( Log ) );

        public static void Write ( Severity severity, object text ) {
            switch (severity) {
                case Severity.Debug:
                    if (log.IsDebugEnabled)
                        log.Debug ( text );
                    break;
                case Severity.Error:
                    if (log.IsErrorEnabled)
                        log.Error ( text );
                    break;
                case Severity.Warn:
                    if (log.IsWarnEnabled)
                        log.Warn ( text );
                    break;
                case Severity.Info:
                    if (log.IsInfoEnabled)
                        log.Info ( text );
                    break;
                case Severity.Fatal:
                    if (log.IsFatalEnabled)
                        log.Fatal ( text );
                    break;
            }
        }

        public static void Write ( Severity severity, object text, Exception ex ) {
            switch (severity) {
                case Severity.Debug:
                    if (log.IsDebugEnabled)
                        log.Debug ( text, ex );
                    break;
                case Severity.Error:
                    if (log.IsErrorEnabled)
                        log.Error ( text, ex );
                    break;
                case Severity.Warn:
                    if (log.IsWarnEnabled)
                        log.Warn ( text, ex );
                    break;
                case Severity.Info:
                    if (log.IsInfoEnabled)
                        log.Info ( text, ex );
                    break;
                case Severity.Fatal:
                    if (log.IsFatalEnabled)
                        log.Fatal ( text, ex );
                    break;
            }
        }

    }

    internal enum Severity {
        Debug,
        Error,
        Warn,
        Info,
        Fatal
    }
}
